<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo ($meta_title); ?>|ItemBank 通用题库管理平台</title>
    <link href="/ItemBank/Public/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="/ItemBank/Public/Admin/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/ItemBank/Public/Admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="/ItemBank/Public/Admin/css/module.css" media="all">
    <link rel="stylesheet" type="text/css" href="/ItemBank/Public/Admin/css/style.css" media="all">
	<link rel="stylesheet" type="text/css" href="/ItemBank/Public/Admin/css/<?php echo (C("COLOR_STYLE")); ?>.css" media="all">
     <!--[if lt IE 9]>
    <script type="text/javascript" src="/ItemBank/Public/static/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="/ItemBank/Public/static/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/ItemBank/Public/Admin/js/jquery.mousewheel.js"></script>
    <!--<![endif]-->
     <script
	src="/ItemBank/Public/static/thinkbox/jquery.thinkbox.js"></script> <script
	type="text/javascript" src="/ItemBank/Public/static/qtip/jquery.qtip.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="/ItemBank/Public/static/qtip/jquery.qtip.min.css" media="all">

</head>
<body oncontextmenu="return false">
    <!-- 头部 -->
    <div class="header">
        <!-- Logo -->
        <span class="logo"></span>
        <!-- /Logo -->

        <!-- 主导航 -->
        <ul class="main-nav">
            <?php if(is_array($__MENU__["main"])): $i = 0; $__LIST__ = $__MENU__["main"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li class="<?php echo ((isset($menu["class"]) && ($menu["class"] !== ""))?($menu["class"]):''); ?>"><a href="<?php echo (u($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
        </ul>
        <!-- /主导航 -->

        <!-- 用户栏 -->
        <div class="user-bar">
            <a href="javascript:;" class="user-entrance"><i class="icon-user"></i></a>
            <ul class="nav-list user-menu hidden">
                <li class="manager">欢迎：<em title="<?php echo session('user_auth.username');?>"><?php echo session('user_auth.username');?></em></li>
                <li><a href="<?php echo U('User/updatePassword');?>">修改密码</a></li>
                <li><a href="<?php echo U('User/updateNickname');?>">修改昵称</a></li>
                <li><a href="<?php echo U('Public/logout');?>">退出</a></li>
            </ul>
        </div>
    </div>
    <!-- /头部 -->

    <!-- 边栏 -->
    <div class="sidebar">
        <!-- 子导航 -->
        
            <div id="subnav" class="subnav">
                <?php if(!empty($_extra_menu)): ?>
                    <?php echo extra_menu($_extra_menu,$__MENU__); endif; ?>
                <?php if(is_array($__MENU__["child"])): $i = 0; $__LIST__ = $__MENU__["child"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sub_menu): $mod = ($i % 2 );++$i;?><!-- 子导航 -->
                    <?php if(!empty($sub_menu)): if(!empty($key)): ?><h3><i class="icon icon-unfold"></i><?php echo ($key); ?></h3><?php endif; ?>
                        <ul class="side-sub-menu">
                            <?php if(is_array($sub_menu)): $i = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li>
                                    <a class="item" href="<?php echo (u($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a>
                                </li><?php endforeach; endif; else: echo "" ;endif; ?>
                        </ul><?php endif; ?>
                    <!-- /子导航 --><?php endforeach; endif; else: echo "" ;endif; ?>
            </div>
        
        <!-- /子导航 -->
    </div>
    <!-- /边栏 -->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
            <?php if(!empty($_show_nav)): ?><div class="breadcrumb">
                <span>您的位置:</span>
                <?php $i = '1'; ?>
                <?php if(is_array($_nav)): foreach($_nav as $k=>$v): if($i == count($_nav)): ?><span><?php echo ($v); ?></span>
                    <?php else: ?>
                    <span><a href="<?php echo ($k); ?>"><?php echo ($v); ?></a>&gt;</span><?php endif; ?>
                    <?php $i = $i+1; endforeach; endif; ?>
            </div><?php endif; ?>
            <!-- nav -->
            

             <!-- 标题栏 -->
<div class="main-title">
	<h2>
		<?php echo ($iteminfo['name']); ?>&nbsp;[
		<?php if(isset($_GET['questiontype'])): ?><a
			href="<?php echo U('index',array('itembank'=>$iteminfo['id'],'chapter'=>$chapter_id));?>">全部</a>
		<?php else: ?> <strong>全部</strong><?php endif; ?>
		&nbsp;
		<?php if(is_array($questiontype)): foreach($questiontype as $key=>$vo): if(($questiontype_id) != $vo): ?><a
			href="<?php echo U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$vo,'chapter'=>$chapter_id));?>"><?php echo (get_questiontype_name($vo)); ?></a>
		<?php else: ?> <strong><?php echo (get_questiontype_name($vo)); ?></strong><?php endif; ?>&nbsp;<?php endforeach; endif; ?>
		]
	</h2>
</div>
<div class="cf">
	<div class="fl">
		<a class="btn"
			href="<?php echo U('add',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id,'chapter'=>$chapter_id));?>">新
			增</a> <a class="btn ajax-post confirm" href="<?php echo U('del');?>"
			target-form="ids">删 除</a> <a class="btn"
			href="<?php echo U('ItemBank/myitems');?>">返 回</a>
	</div>

	<!-- 高级搜索 -->
	<div class="search-form fr cf">
		<div class="sleft">
			<div class="drop-down" style="width: auto;">
				<span id="sch-sort-txt" class="sort-txt" style="width: auto;"><?php if(isset($_GET['chapter'])): echo (get_chapter_name($chapter_id)); else: ?>所有章节<?php endif; ?></span>
				<i class="arrow arrow-down"></i>
				<ul id="sub-sch-menu" class="nav-list hidden">
					<li><a
						href="<?php echo U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id));?>">所有章节</a></li>
					<?php if(is_array($chapter)): foreach($chapter as $key=>$vo): ?><li><a
						href="<?php echo U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id,'chapter'=>$vo));?>"
						value="$vo"><?php echo (get_chapter_name($vo)); ?></a></li><?php endforeach; endif; ?>
				</ul>
			</div>
			<input type="text" name="title" class="search-input"
				value="<?php echo I('title');?>" placeholder="请输入题目内容"> <a
				class="sch-btn" href="javascript:;" id="search"
				url="<?php echo U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id,'chapter'=>$chapter_id));?>"><i
				class="btn-search"></i></a>
		</div>
	</div>
</div>
<!-- 数据列表 -->
<div class="data-table table-striped">
	<table style="table-layout: fixed;">
		<thead>
			<tr>
				<th class="row-selected row-selected"><input class="check-all"
					type="checkbox" /></th>
				<th style="width: 5%;">序号</th>
				<th style="width: 30%;">题目</th>
				<th>类型</th>
				<th>章节</th>
				<th>难度</th>
				<th>空行</th>
				<th>状态</th>
				<th>附件</th>
				<th>答案</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<?php if(!empty($list)): $i = '1'; ?> <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
				<td><input class="ids" type="checkbox" name="id[]"
					value="<?php echo ($vo["id"]); ?>" /></td>
				<td><?php echo ($i); ?></td>
				<td class="questiontitle" style="width: 30%; overflow: hidden;"
					nowrap="nowrap"><?php echo ($vo["title"]); ?></td>
				<td><?php echo (get_questiontype_name($vo["questiontype"])); ?></td>
				<td><?php echo (get_chapter_name($vo["chapter"])); ?></td>
				<td><?php echo (get_difficulty_name($vo["difficulty"])); ?></td>
				<td><?php echo ($vo["answer_rows"]); ?></td>
				<td><?php if($vo["status"] == 1): ?>正常<?php else: ?>禁用<?php endif; ?></td>
				<td><a title="附件"
					href="<?php echo U('QuestionAttachments/index?id='.$vo['id']);?>">管理</a></td>
				<td><a title="答案"
					href="<?php echo U('QuestionAnswers/index?id='.$vo['id']);?>">管理</a></td>
				<td><a title="编辑" href="<?php echo U('edit?id='.$vo['id']);?>">编辑</a> <a
					class="confirm ajax-get" title="禁用" href="#">禁用</a>
				<?php $i = $i++; ?>
			</tr><?php endforeach; endif; else: echo "" ;endif; ?> <?php else: ?>
			<td colspan="9" class="text-center">暂时还没有内容!</td><?php endif; ?>
		</tbody>
	</table>
</div>
<div class="page"><?php echo ($_page); ?></div>

        </div>
        <div class="cont-ft">
            <div class="copyright">
                <div class="fl">感谢使用<a href="#">ItemBank</a>管理平台</div>
                <div class="fr">Version <?php echo (ONETHINK_VERSION); ?></div>
            </div>
        </div>
    </div>
    <!-- /内容区 -->
    <script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "/ItemBank", //当前网站地址
            "APP"    : "/ItemBank", //当前项目地址
            "PUBLIC" : "/ItemBank/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    </script>
    <script type="text/javascript" src="/ItemBank/Public/static/think.js"></script>
    <script type="text/javascript" src="/ItemBank/Public/Admin/js/common.js"></script>
    <script type="text/javascript">
        +function(){
            var $window = $(window), $subnav = $("#subnav"), url;
            $window.resize(function(){
                $("#main").css("min-height", $window.height() - 130);
            }).resize();

            /* 左边菜单高亮 */
            url = window.location.pathname + window.location.search;
            url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
            $subnav.find("a[href='" + url + "']").parent().addClass("current");

            /* 左边菜单显示收起 */
            $("#subnav").on("click", "h3", function(){
                var $this = $(this);
                $this.find(".icon").toggleClass("icon-fold");
                $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
                      prev("h3").find("i").addClass("icon-fold").end().end().hide();
            });

            $("#subnav h3 a").click(function(e){e.stopPropagation()});

            /* 头部管理员菜单 */
            $(".user-bar").mouseenter(function(){
                var userMenu = $(this).children(".user-menu ");
                userMenu.removeClass("hidden");
                clearTimeout(userMenu.data("timeout"));
            }).mouseleave(function(){
                var userMenu = $(this).children(".user-menu");
                userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
                userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
            });

	        /* 表单获取焦点变色 */
	        $("form").on("focus", "input", function(){
		        $(this).addClass('focus');
	        }).on("blur","input",function(){
				        $(this).removeClass('focus');
			        });
		    $("form").on("focus", "textarea", function(){
			    $(this).closest('label').addClass('focus');
		    }).on("blur","textarea",function(){
			    $(this).closest('label').removeClass('focus');
		    });

            // 导航栏超出窗口高度后的模拟滚动条
            var sHeight = $(".sidebar").height();
            var subHeight  = $(".subnav").height();
            var diff = subHeight - sHeight; //250
            var sub = $(".subnav");
            if(diff > 0){
                $(window).mousewheel(function(event, delta){
                    if(delta>0){
                        if(parseInt(sub.css('marginTop'))>-10){
                            sub.css('marginTop','0px');
                        }else{
                            sub.css('marginTop','+='+10);
                        }
                    }else{
                        if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                            sub.css('marginTop','-'+(diff-10));
                        }else{
                            sub.css('marginTop','-='+10);
                        }
                    }
                });
            }
        }();
    </script>
     <script type="text/javascript">
	+function($){
		$('.questiontitle').each(function(){
	        $(this).qtip({
	            content: {
	                text: $(this).text(),
	                title: ' ',
	            },
	            position: {
	                my: 'top center',
	                at: 'bottom center',
	                target: $(this)
	            },
	            style: {
	                classes: 'qtip-green',
	                tip: {
	                    corner: true,
	                    mimic: false,
	                    width: 5,
	                    height: 5
	                }
	            }
	        });
	    });
		
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});
		
		/* 状态搜索子菜单 */
		$(".search-form").find(".drop-down").hover(function(){
			$("#sub-sch-menu").removeClass("hidden");
		},function(){
			$("#sub-sch-menu").addClass("hidden");
		});
		$("#sub-sch-menu li").find("a").each(function(){
			$(this).click(function(){
				$("#sub-sch-menu").addClass("hidden");
			})
		});

		
		//回车搜索
		$(".search-input").keyup(function(e){
			if(e.keyCode === 13){
				$("#search").click();
				return false;
			}
		});
	    //导航高亮
	    $('.side-sub-menu').find('a[href="<?php echo U('ItemBank/myitems');?>"]').closest('li').addClass('current');
	}(jQuery);
	
	</script> 
</body>
</html>